//
//  NRWBuyCarFilterModel.m
//  NRWMall
//
//  Created by 邢毅 on 2018/6/7.
//  Copyright © 2018年 com.anpxd. All rights reserved.
//

#import "NRWBuyCarConditionModel.h"

@interface NRWBuyCarConditionModel()<NSCopying>
@end

@implementation NRWBuyCarConditionModel

- (NRWBuyCarSortModel *)sortModel {
    
    if (_sortModel == nil) {
        _sortModel = [[NRWBuyCarSortModel alloc] init];
        _sortModel.sortName = @"默认排序";
    }
    return _sortModel;
}

- (NRWBuyCarBrandModel *)brandModel {
    
    if (_brandModel == nil) {
        _brandModel = [[NRWBuyCarBrandModel alloc] init];
    }
    return _brandModel;
}

- (NRWBuyCarPriceModel *)priceModel {
    
    if (_priceModel == nil) {
        _priceModel = [[NRWBuyCarPriceModel alloc] init];
        _priceModel.currentSelectIndex = 0;
    }
    return _priceModel;
}

- (NRWBuyCarCityModel *)cityModel {
    
    if (_cityModel == nil) {
        _cityModel = [[NRWBuyCarCityModel alloc] init];
    }
    return _cityModel;
}

- (NRWBuyCarFilterModel *)filterModel {
    
    if (_filterModel == nil) {
        _filterModel = [[NRWBuyCarFilterModel alloc] init];
    }
    return _filterModel;
}

@end


@implementation NRWBuyCarSortModel
{
    NSString *_mOrderMode;
    NSString *_mOrderColunm;
}

- (void)setSortName:(NSString *)sortName {
    
    _sortName = sortName;
    
    if ([sortName isEqualToString:@"默认排序"]) {
        
        _mOrderMode = @"DESC";
        _mOrderColunm = @"CAR_UPDATE_TIME";
    } else if ([sortName isEqualToString:@"最新发布"]) {
        
        _mOrderColunm = @"CAR_SALE_TIME";
        _mOrderMode = @"DESC";
    } else if ([sortName isEqualToString:@"价格最低"]) {
        
        _mOrderColunm = @"CAR_RETAIL_PRICE";
        _mOrderMode = @"ASC";
    } else if ([sortName isEqualToString:@"价格最高"]) {
        
        _mOrderColunm = @"CAR_RETAIL_PRICE";
        _mOrderMode = @"DESC";
    } else if ([sortName isEqualToString:@"车龄最短"]) {
        
        _mOrderColunm = @"CAR_LICENCE_DATE";
        _mOrderMode = @"DESC";
    } else if ([sortName isEqualToString:@"里程最少"]) {
        
        _mOrderColunm = @"CAR_MILEAGE";
        _mOrderMode = @"ASC";
    }
}

- (NSString *)orderColunm {
    
    return _mOrderColunm;
}

- (NSString *)orderMode {
    
    return _mOrderMode;
}

@end

@implementation NRWBuyCarBrandModel

@end

@implementation NRWBuyCarPriceModel

@end

@implementation NRWBuyCarCityModel

@end

@implementation NRWBuyCarFilterModel

@end
